org 0x0
start:
	;jz/jnz
	mov A,#0
	jnz next0
	mov 0x20,#0x30
	jz next0
	mov 0x20,#0x31
	sjmp $
next0:
	mov a,#1
	jz next1
	mov 0x21,#0x30
	jnz next1
	mov 0x21,#0x31
	sjmp $
next1:
	;DJNZ Rn,rel
	mov r0,#8
	mov A,#0
loop0:
	ADD A,#1
	DJNZ R0,loop0
	mov 0x22,A
	;DJNZ direct,rel
	mov 0x40,#8
	mov a,#0x12
loop1:
	add a,#1
	djnz 0x40,loop1
	mov 0x23,A
	;cjne a,direct,rel
	mov A,#0x20
	mov 0x41,#0x20
	CJNE A,0x41,die
	CJNE A,#0x33,next5
	mov 0x24,#0x45
	sjmp $
next5:
	mov 0x24,#0x55
	mov R0,#0x12
	cjne R0,#0x34,cjne_next1
	sjmp $
cjne_next1:
	mov 0x40,#0x80
	mov R0,#0x40
	cjne @R0,#0x45,die
	sjmp $
die:
	sjmp $
;for test
REG_SP     EQU 0x1000
REG_A      EQU 0x1001
REG_B      EQU 0x1002
REG_PSW    EQU 0x1003
REG_PC     EQU 0x1004
REG_DPTR   EQU 0x1005
CYCLE      EQU 0x1006
REG_R0     EQU 0x2000
REG_R1     EQU 0x2001
REG_R2     EQU 0x2002
REG_R3     EQU 0x2003
REG_R4     EQU 0x2004
REG_R5     EQU 0x2005
REG_R6     EQU 0x2006
REG_R7     EQU 0x2007
REG_END    EQU 0x2FFF
	org 0x600
	dw 0x20, 0x30
	dw 0x21, 0x30
	dw 0x22, 0x08
	dw 0x23, 0x1A
	dw 0x24, 0x55
	dw REG_SP,    0x7
	dw REG_A,     0x20
	dw REG_B,     0x0
	dw	REG_PSW,  0x1
	dw REG_PC,    0x56
	dw REG_DPTR,  0x0
	dw CYCLE,     88
	dw REG_R0,    0x40
	dw REG_R1,    0x0
	dw REG_R2,    0x0
	dw REG_R3,    0x0
	dw REG_R4,    0x0
	dw REG_R5,    0x0
	dw REG_R6,    0x0
	dw REG_R7,    0x0
	dw REG_END,0
end
	